//go:build wireinject
//+build awireinject

package db

import (
	"gitee.com/yysf-xin/dproxy/pkg/app"
	"github.com/google/wire"
	"gorm.io/gorm"
)

func UseDB(c *Client) *gorm.DB {
	return c.Db
}
func UseDbConfig(cfg *app.ConfigFile) *app.DbConfig {
	return &cfg.Db
}

var DbSet = wire.NewSet(UseDB, NewClient, UseDbConfig)

var dbSet = wire.NewSet(UseDB, NewClient)

func NewDB(*app.DbConfig) (*Client, error) {
	wire.Build(dbSet)
	return &Client{},nil
}
